package com.four.marketing.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.four.marketing.entity.Bargain;
import com.four.marketing.dao.BargainDao;
import com.four.marketing.feign.ShopFeginService;
import com.four.marketing.service.BargainService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.four.marketing.vo.BargainVo;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.guli.common.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 侯新伟
 * @since 2021-12-14
 */
@Service
public class BargainServiceImpl extends ServiceImpl<BargainDao, Bargain> implements BargainService {

    @Autowired
    private BargainDao bargainDao;
    @Autowired
    private ShopFeginService shopFeginService;


    @Override
    public IPage<Bargain> getList(Integer page, Integer pageSize, BargainVo vo) {
        Page<Bargain> goodsVoPage = new Page<>(page, pageSize);
        return bargainDao.getPage(goodsVoPage,vo);
    }

    @Override
    public void saveBargain(Bargain bargain) {
        bargainDao.saveBargain(bargain);
    }

    @Override
    public void updateBargain(Bargain bargain) {
        bargainDao.updateBargain(bargain);
    }

    @Override
    public R shopList() {

        return shopFeginService.shopList();
    }

    @Override
    public R getShopById(Integer manId) {

        return shopFeginService.getShopById(manId);
    }
}
